PuTTY on my USB keychain drive

Mr. Muskrat on 2004-02-17T04:09:42

Today I moved PuTTY to my USB keychain drive (it's an Handy Steno 2.0 256MB). I slightly modified the instructions given in the PuTTY help file.

My configuration is imported into the registry prior to starting PuTTY. It's exported again when I'm done so that any changes that I make are stored. Then the registry keys are deleted.

I made a directory "putty" on my USB keychain drive and created the following files in it:

:: putty.bat ::
@ECHO OFF
:: At work my USB drive is E: but at home it is F.
:: Adjust the next two lines for your setup.
set USB=E
if !%COMPUTERNAME%! == !Your_Computer_Name_Here! set USB=F
regedit /s putty.reg
echo REGEDIT4 >puttyrnd.reg
echo. >>puttyrnd.reg
echo [HKEY_CURRENT_USER\Software\SimonTatham\PuTTY] >>puttyrnd.reg
set foo="RandSeedFile"="%USB%:\\putty\\putty.rnd"
echo %foo% >>puttyrnd.reg
echo. >>puttyrnd.reg
echo [HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\dev1] >>puttyrnd.reg
set foo="PublicKeyFile"="%USB%:\\putty\\public.key"
echo %foo% >>puttyrnd.reg
regedit /s puttyrnd.reg
start /w putty.exe
regedit /e puttynew.reg HKEY_CURRENT_USER\Software\SimonTatham\PuTTY
copy puttynew.reg putty.reg >>nul
del puttynew.reg
regedit /s puttydel.reg

      8< - - - - - - - - - - - - - - - - - - >8

; puttydel.reg
REGEDIT4

[-HKEY_CURRENT_USER\Software\SimonTatham\PuTTY]

      8< - - - - - - - - - - - - - - - - - - >8

I exported my registry information into putty.reg using regedit /e putty.reg HKEY_CURRENT_USER\Software\SimonTatham\PuTTY. I imported the information in puttyrnd.reg into the registry by double-clicking the file. (Once it is imported, feel free to delete it, I did.) Next I moved all of my PuTTY files from the hard drive to the USB drive in the putty directory. Next, I started up a command prompt (you remember DOS don't you?). I changed into the putty directory on my USB drive. I ran putty.bat. When I exited out of PuTTY, all of my settings were saved. If I make changes while in a PuTTY session, those changes are saved as well. Very nice.

Updated: putty.bat to properly handle the %USB% environment variable.

Updated: Added export info. Thanks simonflk!


I wish I knew how to do this...

brian_d_foy on 2004-02-17T16:58:07

I've been trying to figure this out for a while, but my Windows kung-fu is very bad. I would love to get this working for Firefox so I can keep my bookmarks on the USB key drive.

Thanks so much for this info. :)

Re:I wish I knew how to do this...

Mr. Muskrat on 2004-02-18T05:34:54

I posted this with you in mind.

I can try to put Firefox on it next if you would like.

Re:I wish I knew how to do this...

brian_d_foy on 2004-02-18T15:28:39

I thought FireFox would do this for me. When I installed it, it asked where I wanted the settings. It put them on the E: drive just as I asked, and even set up the profile there. Then it forgot all about that.

This is a really interesting problem over here---a lot of people have these USB key drives, and most of us are forced to use public computers. Instead of thinking about the desktop as a login account, where everyone stores their stuff on the same disk, how about a model where everything about the user is stored on their key drive (or flash card, or credit card, whatever)? Forget about this registry stuff.

Re:I wish I knew how to do this...

Mr. Muskrat on 2004-02-18T20:08:10

Run FireFox from removable media (This will only work if you are running Windows 2000 or XP.)

Customize the cache

What if they already use putty?

simonflk on 2004-02-17T18:46:30

Nice one.

However, when you run that you overwrite any putty settings that the logged in user already has. I'd suggest exporting the registry key first and restoring it at the end.

Another option would be to install cygwin ssh and scp to your USB device.

Re:What if they already use putty?

Mr. Muskrat on 2004-02-17T22:39:04

Oops! I inadvertantly left out the export step. I'll update it.